<?php
class DashboardsController extends AppController {
	var $name = 'Dashboards';
	var $uses = array('Sprint','Task');
	var $layout = 'controlpanel';

	function index() {
		$this->Task->recursive = 1;
		$currentSprint = $this->Sprint->find('first',array('order' => array('Sprint.id DESC')));
		
		$plannedTasks = $this->Task->getTasksBySprintAndStatus($currentSprint['Sprint']['id'], 1);
		$workingTasks = $this->Task->getTasksBySprintAndStatus($currentSprint['Sprint']['id'], 2);
		$verifingTasks = $this->Task->getTasksBySprintAndStatus($currentSprint['Sprint']['id'], 3);
		$doneTasks = $this->Task->getTasksBySprintAndStatus($currentSprint['Sprint']['id'], 4);
		
		//debug($plannedTasks);
		
		//$tasks = $this->paginate('Task',array('projects_id' => $this->Session->read('selectedProject')));
		
		$this->set('plannedTasks', $plannedTasks);
		$this->set('workingTasks', $workingTasks);
		$this->set('verifingTasks', $verifingTasks);
		$this->set('doneTasks', $doneTasks);
	}
}
?>